home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
os2
/
sysb091a.zip
/
sysbench
/
src
/
pmb_main.c
< prev
next >
Wrap
Text File
|
1996-06-08
|
39KB
|
1,229 lines
// Sysbench main file
//#define INCL_NOCOMMON
#define INCL_DOSMISC
#define INCL_DOSDEVICES
#define INCL_DOSPROCESS
#define INCL_DOSDEVIOCTL
//#define INCL_DOSSEMAPHORES
#define INCL_DOSERRORS
#define INCL_WINWINDOWMGR
#define INCL_WINMESSAGEMGR
#define INCL_WINFRAMEMGR
#define INCL_WINDIALOGS
#define INCL_WININPUT
#define INCL_WINSWITCHLIST
#define INCL_WINPROGRAMLIST
#define INCL_WINERRORS /* Window Error Functions */
#define INCL_WINDESKTOP
#define INCL_WINSTDFILE
#define INCL_GPICONTROL
#define INCL_GPIPRIMITIVES
#define INCL_WIN
#define INCL_PM
#define IDM_RESOURCE 1
#define INCL_GPI
#define INCL_GPILCIDS
#define INCL_GPIPRIMITIVES
#include <os2.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "types.h"
#include "pmb.h"
#include "pmb_bench.h"
#include "pmb_datatype.h"
#define CLS_CLIENT "SysBenchWindowClass"
#define SYSB_VER "0.9.1"
#define THR_DONE (WM_USER + 1)
#define THR_UPDATE (WM_USER + 2)
#define START_STACKSIZE 65536
#define DISP_LINES (75)
#define MB (1048576)
#define KB 1024
#define MN 1000000
// ********** IMPORTED FUNCTIONS
extern int pmb_diskio_disksize(int nr);
extern int pmb_diskio_nrdisks(void);
extern void log(char* s);
// ********** EXPORTED FUNCTIONS
void err(char* s);
void InfoBox(char* s);
void WarnBox(char* s);
void ErrorBox(char* s);
// ********** LOCAL FUNCTIONS
static void SetTitle(char* s);
static void UpdateWindow(HPS hpsPaint, PRECTL pRect, s32 scrollValue);
static void Print(s32 row, s32 col, char* string, PRECTL pRect,
s32 scrollValue, HPS hpsPaint, s32 color);
static void SetMenuState(bool active);
static void UpdateAll(void);
static void SaveResults(void);
static void PrintFile(s32 newlines, s32 col, char* string, FILE* fp);
MRESULT EXPENTRY ClientWindowProc ( HWND hwndWnd,
ULONG ulMsg,
MPARAM mpParm1,
MPARAM mpParm2 );
// ********** EXPORTED DATA
double test_time;
static HWND hwndClient = NULLHANDLE;
static HWND hwndVertScroll;
static HWND hwndMenu;
// ********** LOCAL DATA
static bool thread_running;
static s32 fontW;
static s32 fontH;
static HPS mainHps = NULLHANDLE;
//static HAB hab = NULLHANDLE;
static s32 scroll = 0;
static s32 oldscroll = 0;
static HWND hwndFrame = NULLHANDLE;
struct glob_data data = {
1,
1,
{ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 },
{
{
"Graphics",
8,
{
{ "BitBlt S->S cpy", -1.0, MN, "Mpixels/s" },
{ "BitBlt M->S cpy", -1.0, MN, "Mpixels/s" },
{ "Filled Rectangle", -1.0, MN, "Mpixels/s" },
{ "Pattern Fill", -1.0, MN, "Mpixels/s" },
{ "Vertical Lines", -1.0, MN, "Mpixels/s" },
{ "Horizontal Lines", -1.0, MN, "Mpixels/s" },
{ "Diagonal Lines", -1.0, MN, "Mpixels/s" },
{ "Text Render", -1.0, MN, "Mpixels/s" }
},
-1.0,
"PM-marks"
},
{
"CPU integer",
4,
{
{ "Dhrystone", -1.0, MN, "VAX 11/780 MIPS" },
{ "Hanoi", -1.0, 1, "moves/25 usec" },
{ "Heapsort", -1.0, MN, "MIPS" },
{ "Sieve", -1.0, MN, "MIPS" }
},
-1.0,
"CPUint-marks"
},
{
"CPU float",
3,
{
{ "Linpack", -1.0, 1000, "MFLOPS" },
{ "Flops", -1.0, MN, "MFLOPS" },
{ "Fast Fourier Tr.", -1.0, 1, "VAX FFT's" }
},
-1.0,
"CPUfloat-marks"
},
{
"Direct Interface to video extensions - DIVE",
3,
{
{ "Video bus bandw.", -1.0, MB, "MB/s" },
{ "DIVE fun", -1.0, 1, "fps at 640x480x256" },
{ "M->S, DD, 1.00:1", -1.0, 1, "fps at 640x480x256" }
},
-1.0,
"DIVE-marks"
},
{
"Disk I/O",
4,
{
{ "Avg. data access time", -1.0, 1.0e-03, "ms" },
{ "Cache/Bus xfer rate ", -1.0, MB, "MB/s" },
{ "Average Transfer rate", -1.0, MB, "MB/s" },
{ "Disk use CPU load ", -1.0, 1, "percent" }
},
-1.0,
"DiskIO-marks"
},
{
"Memory",
27,
{
{ "5 kB copy", -1.0, MB, "MB/s" },
{ "10 kB copy", -1.0, MB, "MB/s" },
{ "20 kB copy", -1.0, MB, "MB/s" },
{ "40 kB copy", -1.0, MB, "MB/s" },
{ "80 kB copy", -1.0, MB, "MB/s" },
{ "160 kB copy", -1.0, MB, "MB/s" },
{ "320 kB copy", -1.0, MB, "MB/s" },
{ "640 kB copy", -1.0, MB, "MB/s" },
{ "1280 kB copy", -1.0, MB, "MB/s" },
{ "5 kB read", -1.0, MB, "MB/s" },
{ "10 kB read", -1.0, MB, "MB/s" },
{ "20 kB read", -1.0, MB, "MB/s" },
{ "40 kB read", -1.0, MB, "MB/s" },
{ "80 kB read", -1.0, MB, "MB/s" },
{ "160 kB read", -1.0, MB, "MB/s" },
{ "320 kB read", -1.0, MB, "MB/s" },
{ "640 kB read", -1.0, MB, "MB/s" },
{ "1280 kB read", -1.0, MB, "MB/s" },
{ "5 kB write", -1.0, MB, "MB/s" },
{ "10 kB write", -1.0, MB, "MB/s" },
{ "20 kB write", -1.0, MB, "MB/s" },
{ "40 kB write", -1.0, MB, "MB/s" },
{ "80 kB write", -1.0, MB, "MB/s" },
{ "160 kB write", -1.0, MB, "MB/s" },
{ "320 kB write", -1.0, MB, "MB/s" },
{ "640 kB write", -1.0, MB, "MB/s" },
{ "1280 kB write", -1.0, MB, "MB/s" },
},
-1.0,
"Mem-marks"
}
}
};
INT main ( VOID )
{
FATTRS fat;
LONG match;
FONTMETRICS fmMetrics ;
HMQ hmq = NULLHANDLE;
HAB hab = NULLHANDLE; /* PM anchor block handle */
HAB hab1 = NULLHANDLE; /* PM anchor block handle */
HWND hwndDeskTop;
ERRORID erridErrorCode;/* last error id code */
ULONG flCreate = 0UL;
BOOL bLoop;
QMSG qmsg;
RECTL rect;
s32 x,y,w,h, i;
MENUITEM mi;
HWND hwndPullDown;
CHAR tmp[256];
int rc = 1;
if ( ( hab = WinInitialize ( 0UL ) ) == NULLHANDLE )
exit(2);
if ( ( hmq = WinCreateMsgQueue ( hab, 0UL ) ) == NULLHANDLE )
exit(3);
erridErrorCode = WinGetLastError(hab);
rc = WinRegisterClass ( hab,
CLS_CLIENT,
ClientWindowProc,
CS_SIZEREDRAW, /* CS_SYNCPAINT | */
0UL );
erridErrorCode = WinGetLastError(hab);
if ( rc != TRUE )
{
log("WinRegisterClass failed") ;
exit(4);
}
flCreate = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MENU |
FCF_MINMAX | FCF_TASKLIST | FCF_NOBYTEALIGN | FCF_VERTSCROLL;
hwndDeskTop = WinQueryDesktopWindow(hab1,
NULLHANDLE);
hwndFrame = WinCreateStdWindow( hwndDeskTop,
WS_VISIBLE,
&flCreate,
CLS_CLIENT,
SYSB_VER,
CS_SIZEREDRAW,
NULLHANDLE,
WND_MAIN,
&hwndClient );
erridErrorCode = WinGetLastError(hab);
if ( hwndFrame == NULLHANDLE )
{
log("hwndFrame is NULLHANDLE");
exit(6);
}
mainHps = WinGetPS(hwndClient);
fat.usRecordLength = sizeof(FATTRS); /* sets size of structure */
fat.fsSelection = 0; /* uses default selection */
fat.lMatch = 0; /* does not force match */
fat.idRegistry = 0; /* uses default registry */
fat.usCodePage = 0; /* code-page 850 */
fat.lMaxBaselineExt = 12L; /* requested font height is 12 pels */
fat.lAveCharWidth = 8L; /* requested font